<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <body>

        <ui:composition template="./adminTemplate.xhtml">

            <ui:define name="title">
                List Advertise
            </ui:define>

            <ui:define name="contain">
                <h:form id="form">
                    <h2 class="ico_mug">List Advertise</h2>
                    <p:dataTable id="table-item" var="a" value="#{advertiseController.listAdvertise}" 
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                 rowsPerPageTemplate="10,15,20" paginator="true" rows="10">  
                        <p:column style="text-align: center">  
                            <f:facet name="header">  
                                ID 
                            </f:facet>  
                            <h:outputText value="#{a.id}" />  
                        </p:column>  
                        <p:column>  
                            <f:facet name="header">  
                                Name 
                            </f:facet>  
                            <h:commandLink action="detailAdvertise">
                                <f:setPropertyActionListener value="#{a}" target="#{advertiseBean.advertise}" />
                                <h:outputText value="#{a.name}" />  
                            </h:commandLink>
                        </p:column>                              
                        <p:column>  
                            <f:facet name="header">  
                                Designation
                            </f:facet>  
                            <h:outputText value="#{a.designation}" />  
                        </p:column>
                        <p:column>  
                            <f:facet name="header">  
                                Mobile  
                            </f:facet>  
                            <h:outputText value="#{a.mobile}"/>
                        </p:column>                    
                        <p:column>  
                            <f:facet name="header">  
                                Telephone 
                            </f:facet>  
                            <h:outputText value="#{a.telephone}" />  
                        </p:column> 
                        <p:column>  
                            <f:facet name="header">  
                                Fax 
                            </f:facet>  
                            <h:outputText value="#{a.fax}" />  
                        </p:column> 
                        <p:column>  
                            <f:facet name="header">  
                                Email 
                            </f:facet>  
                            <h:outputText value="#{a.email}"/>
                        </p:column>

                        <p:column style="text-align: center;width: 60px">  
                            <f:facet name="header">  
                                Action  
                            </f:facet>  
                            
                            <h:commandLink action="detailAdvertise">
                                <f:setPropertyActionListener value="#{a}" target="#{advertiseBean.advertise}" />
                                <img src="img/detail.png" alt="edit"/>
                            </h:commandLink>
                            <p:commandLink action="#{advertiseController.selectedID(a.id)}" oncomplete="confirmation.show()">
                                <img src="img/delete.png" alt="delete"/>
                            </p:commandLink>
                        </p:column> 
                    </p:dataTable>
                    <p:confirmDialog id="confirmation" message="Are you sure to delete this Advertise?"  
                                     header="Delete Advertise" severity="alert" widgetVar="confirmation" > 
                        <p:commandButton value="Yes Sure" update=":form:table-item" oncomplete="confirmation.hide()"  
                                         actionListener="#{advertiseController.deleteAdvertise()}" />  
                        <p:commandButton value="Not Yet" onclick="confirmation.hide()" type="button" />   
                    </p:confirmDialog>
                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
